<?php
/**
* Init theme options to white list our options
*/
function complete_settings_init(){
register_setting( 'complete_settings', 'complete_theme_settings' );
}
function complete_scripts() {
wp_enqueue_script("theme-admin", get_bloginfo('stylesheet_directory')."/functions/functions.js", false, "1.0");
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_script('bbq', get_bloginfo('stylesheet_directory') . '/functions/jquery.ba-bbq.min.js');
}
function complete_style() {
wp_enqueue_style("theme-admin", get_bloginfo('stylesheet_directory')."/functions/functions.css", false, "1.0", "all");
wp_enqueue_style('thickbox');
}
function complete_echo_scripts()
{
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {

/** Tabs functionality **/
jQuery(function () {
var tabContainers = jQuery('div.adminTabs > div');
tabContainers.hide().filter(':first').show();

jQuery('div.adminTabs ul.tabsNavi a').click(function () {
tabContainers.hide();
tabContainers.filter(this.hash).show();
jQuery('div.adminTabs ul.tabsNavi a').removeClass('selected');
jQuery(this).addClass('selected');
return false;
}).filter(':first').click();
});

// Media Uploader
window.formfield = '';

jQuery('.upload_image_button').live('click', function() {
window.formfield = jQuery('.upload_field',jQuery(this).parent());
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
return false;
});

window.original_send_to_editor = window.send_to_editor;
window.send_to_editor = function(html) {
if (window.formfield) {
imgurl = jQuery('img',html).attr('src');
window.formfield.val(imgurl);
tb_remove();
}
else {
window.original_send_to_editor(html);
}
window.formfield = '';
window.imagefield = false;
}

});
//]]> 
</script>
<?php
}
if (isset($_GET['page']) && $_GET['page'] == 'complete-settings')
{
add_action('admin_print_scripts', 'complete_scripts'); 
add_action('admin_print_styles', 'complete_style');
}
add_action('admin_head', 'complete_echo_scripts');

/************************************
* Load up the menu page
************************************/
function complete_add_settings_page() {
add_theme_page( __( 'Theme Settings' ), __( 'Theme Settings' ), 'manage_options', 'complete-settings', 'complete_theme_settings_page');
}

add_action( 'admin_init', 'complete_settings_init' );
add_action( 'admin_menu', 'complete_add_settings_page' );

/************************************
* set up all the select field options
************************************/
$theme_styles = array("default", "boxed");
$button_colors = array("default", "blue", "orange", "red", "green", "purple","black");
$background_textures = array("none", "checkerboard", "diamonds", "diagonal", "vertical");
$fonts = array('Default','Arial','Georgia','Lucida Sans Unicode','Times New Roman','Verdana','Droid Sans', 'Ubuntu', 'Nobile','Molengo','Arvo','Coming Soon','Tangerine','Cantarell','Vollkorn','Chewy');
$slider_effects = array("random", "fade", "fold", "slideInRight", "slideInLeft", "sliceDown", "sliceDownLeft", "sliceUp", "sliceUpLeft", "sliceUpDown", "sliceUpDownLeft", "boxRandom", "boxRain", "boxRainReverse", "boxRainGrow", "boxRainGrowReverse");
$home_types = array("business","blog");
$home_sections = array("none", "shoutbox", "highlights", "portfolio");
$pricing_columns = array("four","three");
$blog_styles = array("Excerpts", "Full Posts");
$portfolio_columns = array("two", "three","four");


// store all pages in an array for use in options
$list_pages = get_pages('hide_empty=0');
$wp_pages = array();
foreach ($list_pages as $pagg) {
$wp_pages[$pagg->ID] = htmlspecialchars($pagg->post_title);
$wp_pages_ids[] = $pagg->ID;
}
array_unshift($wp_pages, "Choose A Page");


// store all categories in an array for use in options
$categories = get_categories('hide_empty=0&orderby=name');
$wp_cats = array();
foreach ($categories as $category_list ) {
$wp_cats[$category_list->cat_ID] = $category_list->cat_name;
}
array_unshift($wp_cats, "Choose A Category"); 


/**********************************
* Create the options page
*********************************/
function complete_theme_settings_page() {
global $wp_pages, $theme_styles, $button_colors, $background_textures, $slider_effects, $home_types, $home_sections, $pricing_columns, $blog_styles, $portfolio_columns, $sidebar_positions, $fonts;

if ( ! isset( $_REQUEST['updated'] ) )
$_REQUEST['updated'] = false;
?>

<div class="wrap">
  <div id="options-header">
  <h2><?php _e( 'Complete Theme Settings' ); ?></h2>
</div>
<!-- END header -->

<div id="panel-content">

<form method="post" action="options.php">

<?php settings_fields( 'complete_settings' ); ?>
<?php $options = get_option( 'complete_theme_settings' ); ?>

<div id="wrap-left">
<ul class="tabs">
<li class="no-margin-top"><a href="#tab1" id="complete-main"><?php _e( 'Main' ); ?></a></li>
<li><a href="#tab2" id="complete-styling"><?php _e( 'Styling' ); ?></a></li>
<li><a href="#tab3" id="complete-fonts"><?php _e( 'Fonts' ); ?></a></li>
<li><a href="#tab4" id="complete-home"><?php _e( 'Homepage' ); ?></a></li>
<li><a href="#tab5" id="complete-slider"><?php _e( 'Slider' ); ?></a></li>
<li><a href="#tab6" id="complete-portfolio"><?php _e( 'Portfolio' ); ?></a></li>
<li><a href="#tab7" id="complete-pricing"><?php _e( 'Pricing Tables' ); ?></a></li>
<li><a href="#tab8" id="complete-blog"><?php _e( 'Blog' ); ?></a></li>
<li><a href="#tab9" id="complete-social"><?php _e( 'Social' ); ?></a></li>
<li><a href="#tab10" id="complete-footer"><?php _e( 'Footer' ); ?></a></li>
<li><a href="#tab11" id="complete-tracking"><?php _e( 'Tracking Code' ); ?></a></li>
</ul>
<!-- END tabs -->
</div>
<!-- END wrap-left -->

<div id="wrap-right">
<div class="tab_container">
<div id="tab1" class="tab_content"><!--main tab-->

<ul>
<h2><?php _e('Logo Settings'); ?></h2>
<li><h3><?php _e( 'Main Logo' ); ?></h3>
<input id="complete_theme_settings[upload_mainlogo]" class="regular-text upload_field" type="text" size="36" name="complete_theme_settings[upload_mainlogo]" value="<?php esc_attr_e( $options['upload_mainlogo'] ); ?>" />
<input class="upload_image_button" type="button" value="Upload Image" />
<label class="description" for="complete_theme_settings[upload_mainlogo]"><?php _e( 'Upload or type in the URL for the main logo. This is the logo that appears on the top-left area of your site.' ); ?></label>
<?php if($options['upload_mainlogo']) { ?>
<div class="logo-preview">
<img src="<?php echo $options['upload_mainlogo']; ?>" alt="Current Logo" />
</div>
<?php } ?>
</li>

<h2>Favicon Settings</h2>

<li><h3><?php _e( 'Favicon' ); ?></h3>
<input id="complete_theme_settings[upload_favicon]" class="regular-text upload_field" type="text" size="36" name="complete_theme_settings[upload_favicon]" value="<?php esc_attr_e( $options['upload_favicon'] ); ?>" />
<input class="upload_image_button" type="button" value="Upload Image" />
<label class="description" for="complete_theme_settings[upload_favicon]"><?php _e( 'Enter the URL of your .ico favicon file' ); ?></label>
</li>
</ul>

</div>
<!--END main tab-->

<div id="tab2" class="tab_content"><!--styling tab-->
<ul>           

<h2>Main Settings</h2>
<li><h3><?php _e( 'Primary Color' ); ?></h3>
<input id="complete_theme_settings[main_color]" class="regular-text color-picker" type="text" name="complete_theme_settings[main_color]" value="<?php esc_attr_e( $options['main_color'] ); ?>" />
<?php if($options['main_color']) { ?>
<div class="color-preview" style="background: #<?php esc_attr_e( $options['main_color'] ); ?>;" ></div>
<?php } ?>
<label class="description" for="complete_theme_settings[main_color]"><?php _e( 'choose your color for your navigation hover overs, pagination and read more buttons' ); ?></label>
</li>

<li><h3><?php _e( 'Slider Color' ); ?></h3>
<input id="complete_theme_settings[slider_color]" class="regular-text color-picker" type="text" name="complete_theme_settings[slider_color]" value="<?php esc_attr_e( $options['slider_color'] ); ?>" />
<?php if($options['slider_color']) { ?>
<div class="color-preview" style="background: #<?php esc_attr_e( $options['slider_color'] ); ?>;" ></div>
<?php } ?>
<label class="description" for="complete_theme_settings[slider_color]"><?php _e( 'choose your color for your slider background' ); ?></label>
</li>

<h2>Individual Settings</h2>
<li><h3><?php _e( 'Content Text' ); ?></h3>
<input id="complete_theme_settings[content_text_color]" class="regular-text color-picker" type="text" name="complete_theme_settings[content_text_color]" value="<?php esc_attr_e( $options['content_text_color'] ); ?>" />
<?php if($options['content_text_color']) { ?>
<div class="color-preview" style="background: #<?php esc_attr_e( $options['content_text_color'] ); ?>;" ></div>
<?php } ?>
</li>
<li><h3><?php _e( 'Links' ); ?></h3>
<input id="complete_theme_settings[links_color]" class="regular-text color-picker" type="text" name="complete_theme_settings[links_color]" value="<?php esc_attr_e( $options['links_color'] ); ?>" />
<?php if($options['links_color']) { ?>
<div class="color-preview" style="background: #<?php esc_attr_e( $options['links_color'] ); ?>;" ></div>
<?php } ?>
</li>
<li><h3><?php _e( 'Link Hover' ); ?></h3>
<input id="complete_theme_settings[links_hover_color]" class="regular-text color-picker" type="text" name="complete_theme_settings[links_hover_color]" value="<?php esc_attr_e( $options['links_hover_color'] ); ?>" />
<?php if($options['links_hover_color']) { ?>
<div class="color-preview" style="background: #<?php esc_attr_e( $options['links_hover_color'] ); ?>;" ></div>
<?php } ?>
</li>

</ul>
</div>
<!-- END styling tab-->

<div id="tab3" class="tab_content"><!--fonts tab-->
<ul>

<h2>Overall Font Setting</h2>
<li><h3><?php _e( 'Body Font' ); ?></h3>
<select name="complete_theme_settings[body_font]">
<?php foreach ($fonts as $option) { ?>
<option <?php if ($options['body_font'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>
<label class="description" for="complete_theme_settings[body_font]"><?php _e( 'Use this option to quickly change the font for every text on your theme instead of using the individual settings.' ); ?></label>
</li>    

<h2>Header Font Settings</h2>
<li><h3><?php _e( 'Logo Font' ); ?></h3>
<select name="complete_theme_settings[logo_font]">
<?php foreach ($fonts as $option) { ?>
<option <?php if ($options['logo_font'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>
</li>
<li><h3><?php _e( 'Navigation Menu Font' ); ?></h3>
<select name="complete_theme_settings[nav_font]">
<?php foreach ($fonts as $option) { ?>
<option <?php if ($options['nav_font'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>
</li>

<h2>Homepage Slider Font Settings</h2>

<li><h3><?php _e( 'Slider Font' ); ?></h3>
<select name="complete_theme_settings[slider_font]">
<?php foreach ($fonts as $option) { ?>
<option <?php if ($options['slider_font'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>					
</li>

<h2>Content Font Settings</h2>

<li><h3><?php _e( 'Page Title Font' ); ?></h3>
<select name="complete_theme_settings[page_title_font]">
<?php foreach ($fonts as $option) { ?>
<option <?php if ($options['page_title_font'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>					
</li>

<li><h3><?php _e( 'Content Headings Font' ); ?></h3>
<select name="complete_theme_settings[header_font]">
<?php foreach ($fonts as $option) { ?>
<option <?php if ($options['header_font'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>					
</li>

<li><h3><?php _e( 'Content Text Font' ); ?></h3>
<select name="complete_theme_settings[content_font]">
<?php foreach ($fonts as $option) { ?>
<option <?php if ($options['content_font'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>					
</li>


<h2>Footer Font Settings</h2>

<li><h3><?php _e( 'Footer Headings Font' ); ?></h3>
<select name="complete_theme_settings[footer_header_font]">
<?php foreach ($fonts as $option) { ?>
<option <?php if ($options['footer_header_font'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>					
</li>

<li><h3><?php _e( 'Footer Text Font' ); ?></h3>
<select name="complete_theme_settings[footer_text_font]">
<?php foreach ($fonts as $option) { ?>
<option <?php if ($options['footer_text_font'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>					
</li>

</ul>
</div>
<!-- END font tab-->


<div id="tab4" class="tab_content"><!--homepage tab-->
<ul>

<h2>Homepage Style</h2>

<li><h3><?php _e( 'Blog Style Homepage?' ); ?></h3>
<input id="complete_theme_settings[home_blog_style]" name="complete_theme_settings[home_blog_style]" type="checkbox" value="1" <?php checked( '1', $options['home_blog_style'] ); ?> />
<label class="description" for="complete_theme_settings[home_blog_style]"><?php _e( 'Check this box if you would like a normal blog style homepage' ); ?></label>
</li>

<h2>Homepage Modules</h2>

<li><h3><?php _e( 'Homepage Section 1' ); ?></h3>
<select name="complete_theme_settings[home_section_1]">
<?php foreach ($home_sections as $option) { ?>
<option <?php if ($options['home_section_1'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>
</li>

<li><h3><?php _e( 'Homepage Section 2' ); ?></h3>
<select name="complete_theme_settings[home_section_2]">
<?php foreach ($home_sections as $option) { ?>
<option <?php if ($options['home_section_2'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>	
</li>

<li><h3><?php _e( 'Homepage Section 3' ); ?></h3>
<select name="complete_theme_settings[home_section_3]">
<?php foreach ($home_sections as $option) { ?>
<option <?php if ($options['home_section_3'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>
</li>

<h2>Shoutbox Module Settings</h2>

<li><h3><?php _e( 'Homepage Shoutbox Text' ); ?></h3>
<textarea id="complete_theme_settings[home_shoutbox]" class="regular-text" name="complete_theme_settings[home_shoutbox]"><?php esc_attr_e( $options['home_shoutbox'] ); ?></textarea>
<label class="description" for="complete_theme_settings[home_shoutbox]"><?php _e( 'Enter your text for the homepage shout box <small>~ HTML allowed &amp; encouraged</small>' ); ?></label>
</li>


<h2>Portfolio Module Settings</h2>

<li><h3><?php _e( 'Portfolio Title' ); ?></h3>
<input id="complete_theme_settings[home_portfolio_title]" class="regular-text" type="text" name="complete_theme_settings[home_portfolio_title]" value="<?php esc_attr_e( $options['home_portfolio_title'] ); ?>" />
<label class="description" for="complete_theme_settings[home_portfolio_title]"><?php _e( 'Enter the title for your portfolio module <small>~ Default is "Latest Work".</small>' ); ?></label>
</li>

<li><h3><?php _e( 'Number of Portfolio Items' ); ?></h3>
<input id="complete_theme_settings[home_portfolio_count]" class="regular-text" type="text" name="complete_theme_settings[home_portfolio_count]" value="<?php esc_attr_e( $options['home_portfolio_count'] ); ?>" />
<label class="description" for="complete_theme_settings[home_portfolio_count]"><?php _e( 'Enter the number of portfolio items to display in the homepage portfolio module <small>~ Default is 6.</small>' ); ?></label>
</li>

<li><h3><?php _e( 'Portfolio Carousel Speed' ); ?></h3>
<input id="complete_theme_settings[home_portfolio_carousel_speed]" class="regular-text" type="text" name="complete_theme_settings[home_portfolio_carousel_speed]" value="<?php esc_attr_e( $options['home_portfolio_carousel_speed'] ); ?>" />
<label class="description" for="complete_theme_settings[home_portfolio_carousel_speed]"><?php _e( 'Enter the moving transition speed in milliseconds for the homepage highlights carousel<small>~ Default is 1000.</small>' ); ?></label>
</li>

<li><h3><?php _e( 'Portfolio Carousel Move Quantity' ); ?></h3>
<input id="complete_theme_settings[home_portfolio_carousel_quantity]" class="regular-text" type="text" name="complete_theme_settings[home_portfolio_carousel_quantity]" value="<?php esc_attr_e( $options['home_portfolio_carousel_quantity'] ); ?>" />
<label class="description" for="complete_theme_settings[home_portfolio_carousel_quantity]"><?php _e( 'Enter the number of items you want to scroll by when users click the arrows on the portfolio module carousel<small>~ Default is 4</small>' ); ?></label>
</li>

</ul>
</div>
<!-- END homepage tab--> 

<div id="tab5" class="tab_content"><!--slider tab-->
<ul>

<h2>Slider Settings</h2>

<li><h3><?php _e( 'Transition Type' ); ?></h3>
<select name="complete_theme_settings[slider_effect]">
<?php foreach ($slider_effects as $option) { ?>
<option <?php if ($options['slider_effect'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>					
<label class="description" for="complete_theme_settings[slider_effect]"><?php _e( 'Choose the type of transition you want your slider to have. <small>~ Default is random.</small>' ); ?></label>
</li>

<li><h3><?php _e( 'Animation Speed' ); ?></h3>
<input id="complete_theme_settings[slider_animation_speed]" class="regular-text" type="text" name="complete_theme_settings[slider_animation_speed]" value="<?php esc_attr_e( $options['slider_animation_speed'] ); ?>" />
<label class="description" for="complete_theme_settings[slider_animation_speed]"><?php _e( 'Type in the speed for the slide transitions in milliseconds. <small>~ Default is 500.</small>' ); ?></label>
</li>

<li><h3><?php _e( 'Pause Time' ); ?></h3>
<input id="complete_theme_settings[slider_pause_time]" class="regular-text" type="text" name="complete_theme_settings[slider_pause_time]" value="<?php esc_attr_e( $options['slider_pause_time'] ); ?>" />
<label class="description" for="complete_theme_settings[slider_pause_time]"><?php _e( 'This is the time the image is displayed before it transits to the next, in milliseconds. <small>~ Default is 3000.</small>' ); ?></label>
</li>

<li><h3><?php _e( 'Hide Next/Previous Navigation' ); ?></h3>
<input id="complete_theme_settings[slider_hide_navigation]" name="complete_theme_settings[slider_hide_navigation]" type="checkbox" value="1" <?php checked( '1', $options['slider_hide_navigation'] ); ?> />
<label class="description" for="complete_theme_settings[slider_hide_navigation]"><?php _e( 'Check this box if you would like to hide the navigation buttons until hover' ); ?></label>
</li>

<li><h3><?php _e( 'Disable Next/Previous Navigation' ); ?></h3>
<input id="complete_theme_settings[slider_disable_navigation]" name="complete_theme_settings[slider_disable_navigation]" type="checkbox" value="1" <?php checked( '1', $options['slider_disable_navigation'] ); ?> />
<label class="description" for="complete_theme_settings[slider_disable_navigation]"><?php _e( 'Check this box if you would like to disable the next and previous buttons completely' ); ?></label>
</li>

</ul>
</div>
<!-- END sldier tab-->

<div id="tab6" class="tab_content"><!--portfolio tab-->
<ul>

<h2>Main Settings</h2>

<li><h3><?php _e( 'Portfolio Columns' ); ?></h3>
<select name="complete_theme_settings[portfolio_column]">
<?php foreach ($portfolio_columns as $option) { ?>
<option <?php if ($options['portfolio_column'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>					
<label class="description" for="complete_theme_settings[portfolio_column]"><?php _e( 'How many columns do you want your portfolio divided into - both for the portfolio page template and portfolio categories<small>~ Default is 4 columns</small>' ); ?></label>
</li>

<li><h3><?php _e( 'Disable Portfolio Filter' ); ?></h3>
<input id="complete_theme_settings[disable_portfolio_filter]" name="complete_theme_settings[disable_portfolio_filter]" type="checkbox" value="1" <?php checked( '1', $options['disable_portfolio_filter'] ); ?> />
<label class="description" for="complete_theme_settings[disable_portfolio_filter]"><?php _e( 'Check this box to disable the filtering aspect of the portfolio and link to the actual category pages' ); ?></label>
</li>

<li><h3><?php _e( 'Disable Portfolio Details' ); ?></h3>
<input id="complete_theme_settings[disable_portfolio_details]" name="complete_theme_settings[disable_portfolio_details]" type="checkbox" value="1" <?php checked( '1', $options['disable_portfolio_details'] ); ?> />
<label class="description" for="complete_theme_settings[disable_portfolio_details]"><?php _e( 'Check this box to disable the text under the portfolio images on the main portfolio pages' ); ?></label>
</li>

<li><h3><?php _e( 'PrettyPhoto Lightbox Transition Speed' ); ?></h3>
<input id="complete_theme_settings[lightbox_transition_speed]" class="regular-text" type="text" name="complete_theme_settings[lightbox_transition_speed]" value="<?php esc_attr_e( $options['lightbox_transition_speed'] ); ?>" />
<label class="description" for="complete_theme_settings[lightbox_transition_speed]"><?php _e( 'Enter a time in millisenconds for the transition speed of the prettyPhoto lightbox media slideshow<small>~ defualt is 5000</small>' ); ?></label>
</li>

<h2>Portfolio Single Post Settings</h2>

<li><h3><?php _e( 'Disable Related Portfolio Section' ); ?></h3>
<input id="complete_theme_settings[disable_related_portfolio]" name="complete_theme_settings[disable_related_portfolio]" type="checkbox" value="1" <?php checked( '1', $options['disable_related_portfolio'] ); ?> />
<label class="description" for="complete_theme_settings[disable_related_portfolio]"><?php _e( 'Check this box to disable the section that shows related portfolio items on your portfolio pages' ); ?></label>
</li>

<li><h3><?php _e( 'Related Portfolio Title' ); ?></h3>
<input id="complete_theme_settings[related_portfolio_title]" class="regular-text" type="text" name="complete_theme_settings[related_portfolio_title]" value="<?php esc_attr_e( $options['related_portfolio_title'] ); ?>" />
</li> 

</ul>
</div>
<!-- END portfolio tab-->

<div id="tab7" class="tab_content"><!--pricing tab-->
<ul>

<h2>Pricing Table Columns</h2>

<li><h3><?php _e( 'How Many Columns For The Pricing Tables' ); ?></h3>
<select name="complete_theme_settings[pricing_table_count]">
<?php foreach ($pricing_columns as $option) { ?>
<option <?php if ($options['pricing_table_count'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
<?php } ?>
</select>
<label class="description" for="complete_theme_settings[pricing_table_count]"><?php _e( 'Choose a column layout for your pricing tables<small>~ default is four columns"</small>' ); ?></label>
</li>

<h2>Pricing Table Color Settings</h2>

<li><h3><?php _e( 'Header Background' ); ?></h3>
<input id="complete_theme_settings[pricing_table_header_background]" class="regular-text color-picker" type="text" name="complete_theme_settings[pricing_table_header_background]" value="<?php esc_attr_e( $options['pricing_table_header_background'] ); ?>" />
<?php if($options['pricing_table_header_background']) { ?>
<div class="color-preview" style="background: #<?php esc_attr_e( $options['pricing_table_header_background'] ); ?>;" ></div>
<?php } ?>
</li>

<li><h3><?php _e( 'Header Text Color' ); ?></h3>
<input id="complete_theme_settings[pricing_table_header_text_color]" class="regular-text color-picker" type="text" name="complete_theme_settings[pricing_table_header_text_color]" value="<?php esc_attr_e( $options['pricing_table_header_text_color'] ); ?>" />
<?php if($options['pricing_table_header_text_color']) { ?>
<div class="color-preview" style="background: #<?php esc_attr_e( $options['pricing_table_header_text_color'] ); ?>;" ></div>
<?php } ?>
</li> 

</ul>
</div>
<!-- END pricing tab -->

<div id="tab8" class="tab_content"><!--blog tab-->
<ul>

<h2>Blog Settings</h2>

<li><h3><?php _e( 'Show Full Posts' ); ?></h3>
<input id="complete_theme_settings[blog_full_posts]" name="complete_theme_settings[blog_full_posts]" type="checkbox" value="1" <?php checked( '1', $options['blog_full_posts'] ); ?> />
<label class="description" for="complete_theme_settings[blog_full_posts]"><?php _e( 'Check this box if you would like to show full posts on the blog page instead of excerpts' ); ?></label>
</li>

<li><h3><?php _e( 'Excerpt Length' ); ?></h3>
<input id="complete_theme_settings[blog_excerpt_length]" class="regular-text" type="text" name="complete_theme_settings[blog_excerpt_length]" value="<?php esc_attr_e( $options['blog_excerpt_length'] ); ?>" />
<label class="description" for="complete_theme_settings[blog_excerpt_length]"><?php _e( 'Enter a character length for the blog posts excerpts<small>~ Default is 60.</small>' ); ?></label>
</li>

<li><h3><?php _e( 'Disable Related Posts' ); ?></h3>
<input id="complete_theme_settings[disable_related_posts]" name="complete_theme_settings[disable_related_posts]" type="checkbox" value="1" <?php checked( '1', $options['disable_related_posts'] ); ?> />
<label class="description" for="complete_theme_settings[disable_related_posts]"><?php _e( 'Check this box if you would like to disable related posts on your single posts' ); ?></label>
</li>

<li><h3><?php _e( 'Disable Author Bio' ); ?></h3>
<input id="complete_theme_settings[disable_author_bio]" name="complete_theme_settings[disable_author_bio]" type="checkbox" value="1" <?php checked( '1', $options['disable_author_bio'] ); ?> />
<label class="description" for="complete_theme_settings[disable_author_bio]"><?php _e( 'Check this box if you would like to disable the author bio section on single posts' ); ?></label>
</li>
             
</ul>
</div>
<!-- END blog tab-->

<div id="tab9" class="tab_content"><!--social tab-->
<ul>         

<h2>Social Settings</h2>

<li><h3><?php _e( 'Disable Social Links' ); ?></h3>
<input id="complete_theme_settings[social_links]" name="complete_theme_settings[social_links]" type="checkbox" value="1" <?php checked( '1', $options['social_links'] ); ?> />
<label class="description" for="complete_theme_settings[social_links]"><?php _e( 'Check this box if you would like to disable the social links in the footer' ); ?></label>
</li>

<li><h3><?php _e( 'Twitter URL' ); ?></h3>
<input id="complete_theme_settings[twitter]" class="regular-text" type="text" name="complete_theme_settings[twitter]" value="<?php esc_attr_e( $options['twitter'] ); ?>" />
</li>

<li><h3><?php _e( 'Facebook Page URL' ); ?></h3>
<input id="complete_theme_settings[facebook]" class="regular-text" type="text" name="complete_theme_settings[facebook]" value="<?php esc_attr_e( $options['facebook'] ); ?>" />
</li>

<li><h3><?php _e( 'MySpace' ); ?></h3>
<input id="complete_theme_settings[myspace]" class="regular-text" type="text" name="complete_theme_settings[myspace]" value="<?php esc_attr_e( $options['myspace'] ); ?>" />
</li>
<li><h3><?php _e( 'LinkedIn URL' ); ?></h3>
<input id="complete_theme_settings[linkedin]" class="regular-text" type="text" name="complete_theme_settings[linkedin]" value="<?php esc_attr_e( $options['linkedin'] ); ?>" />
</li>

<li><h3><?php _e( 'deviantArt URL' ); ?></h3>
<input id="complete_theme_settings[deviant]" class="regular-text" type="text" name="complete_theme_settings[deviant]" value="<?php esc_attr_e( $options['deviant'] ); ?>" />
</li>

<li><h3><?php _e( 'Dribble URL' ); ?></h3>
<input id="complete_theme_settings[dribbble]" class="regular-text" type="text" name="complete_theme_settings[dribbble]" value="<?php esc_attr_e( $options['dribbble'] ); ?>" />
</li>

<li><h3><?php _e( 'RSS URL' ); ?></h3>
<input id="complete_theme_settings[rss]" class="regular-text" type="text" name="complete_theme_settings[rss]" value="<?php esc_attr_e( $options['rss'] ); ?>" />
</li>

</ul>
</div>
<!-- END end social tab-->

<div id="tab10" class="tab_content"><!--footer tab-->
<ul>

<h2>Footer Settings</h2>

<li><h3><?php _e( 'Disable Back-To-Top Arrow' ); ?></h3>
<input id="complete_theme_settings[disable_back_top_arrow]" name="complete_theme_settings[disable_back_top_arrow]" type="checkbox" value="1" <?php checked( '1', $options['disable_back_top_arrow'] ); ?> />
<label class="description" for="complete_theme_settings[disable_back_top_arrow]"><?php _e( 'Check this box if you would like to disable the back to top arrow in the footer' ); ?></label>
</li>

<li><h3><?php _e( 'Disable Extended Footer' ); ?></h3>
<input id="complete_theme_settings[extended_footer]" name="complete_theme_settings[extended_footer]" type="checkbox" value="1" <?php checked( '1', $options['extended_footer'] ); ?> />
<label class="description" for="complete_theme_settings[extended_footer]"><?php _e( 'Check this box if you would like to disable the extended footer section' ); ?></label>
</li>

</ul>
</div>
<!-- END end footer tab-->  

<div id="tab11" class="tab_content"><!--tracking tab-->
<ul>

<h2>Analytics Tracking Settings</h2>

<li><h3 class="nofloat"><?php _e( 'Header Tracking Code' ); ?></h3>
<textarea id="complete_theme_settings[tracking_header]" class="regular-text" name="complete_theme_settings[tracking_header]"><?php esc_attr_e( $options['tracking_header'] ); ?></textarea>
<label class="description" for="complete_theme_settings[tracking_header]"><?php _e( 'Enter your analytics tracking code to insert it in the head tag of your site' ); ?></label>
</li>

<li><h3 class="nofloat"><?php _e( 'Footer Tracking Code' ); ?></h3>
<textarea id="complete_theme_settings[tracking_footer]" class="regular-text" name="complete_theme_settings[tracking_footer]"><?php esc_attr_e( $options['tracking_footer'] ); ?></textarea>
<label class="description" for="complete_theme_settings[tracking_footer]"><?php _e( 'Enter your analytics tracking code to insert it in the footer of your site right before the end body tag' ); ?></label>
</li>

</ul>
</div>
<!-- END tracking tab-->
</div>
<!-- END tab container-->

</div><!-- END wrap-right -->
<div class="clear"></div>

<p class="submit-changes">
<input type="submit" class="button-primary options-panel-save-btn" value="<?php _e( 'Save Options' ); ?>" />
</p>
</form>
</div>
<!-- END panel-content -->
</div>
<!-- END wrap -->
<?php
}
/************************************
* Sanitize and validate input. Accepts an array, return a sanitized array.
************************************/
function complete_options_validate( $input ) {
global $select_options, $radio_options;

// Our checkbox value is either 0 or 1
if ( ! isset( $input['option1'] ) )
$input['option1'] = null;
$input['option1'] = ( $input['option1'] == 1 ? 1 : 0 );

// Say our text option must be safe text with no HTML tags
$input['sometext'] = wp_filter_nohtml_kses( $input['sometext'] );


// Our radio option must actually be in our array of radio options
if ( ! isset( $input['radioinput'] ) )
$input['radioinput'] = null;
if ( ! array_key_exists( $input['radioinput'], $radio_options ) )
$input['radioinput'] = null;

// Say our textarea option must be safe text with the allowed tags for posts
$input['sometextarea'] = wp_filter_post_kses( $input['sometextarea'] );

return $input;
}

/***********************
* color picker
***********************/
function mfields_color_picker_js() {
wp_enqueue_script('mfields-colorpicker', get_bloginfo('stylesheet_directory') . '/functions/colorpicker.js',
array( 'jquery' ),
false,
true
);
}
add_action( 'admin_print_scripts', 'mfields_color_picker_js' );

function mfields_color_picker_script() {
print <<<EOF
<script>
jQuery( document ).ready( function( $ ) {

/* Apply color picker to classes */
$( '.color-picker' ).ColorPicker( {
onSubmit: function( hsb, hex, rgb, el ) {
$( el ).val( hex );
$( el ).css( 'backgroundColor', '#' + hex );
$( el ).css( 'color', '#' + hex );
$( el ).ColorPickerHide();
},
onBeforeShow: function () {
$( this ).ColorPickerSetColor( this.value );
},
onShow: function ( box ) {
$( box ).fadeIn( 230 );
return false;
},
onHide: function ( box ) {
$( box ).fadeOut( 230 );
return false;
},
} );

} );
</script>
EOF;
}

add_action( 'admin_head', 'mfields_color_picker_script' );

function mfields_color_picker_css() {
wp_enqueue_style(
'mfields-colorpicker', get_bloginfo('stylesheet_directory') . '/functions/colorpicker.css'
);
}
add_action( 'admin_print_styles', 'mfields_color_picker_css' );

?>